package com.central.common.feign.fallback

import com.central.common.feign.VisitService
import feign.hystrix.FallbackFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory

/**
 * @author  fly
 * @date  2021/5/27 17:28
 * @version 1.0
 */
open class VisitServiceFallbackFactory : FallbackFactory<VisitService>{

    private val log: Logger = LoggerFactory.getLogger(VisitServiceFallbackFactory::class.java)


    override fun create(p0: Throwable?): VisitService = object : VisitService {

        override fun getMyVisitUserId(userId: Long): List<String> {

            log.error("获取$userId 的来访列表失败, 失败原因$p0")
            return emptyList()
        }

    }
}